#ifndef __UTIL__TEXTURE_HPP__
#define __UTIL__TEXTURE_HPP__

#include <string>
#include <QGLWidget>

namespace util {
  /** @brief A utility class for one-dimensional textures. */
  class texture1d {
  public:
    texture1d();
    texture1d(const texture1d& texture);
    texture1d(std::string filename);
    ~texture1d();

    const texture1d& operator=(const texture1d& texture);

    void bind();

    // tex parameter functions
    static void clamp(bool enable = true);
    static void filter(bool enable = true);

    // tex environment functions
    static void modulate();
    static void decal();
    static void blend();
    static void replace();

  private:
    GLubyte*     data;
    unsigned int size;
    GLuint       tex_name;

    bool clamped;
  };

  /** @brief A utility class for two-dimensional textures. */
  class texture2d {
  public:
    texture2d();
    texture2d(const texture2d& texture);
    texture2d(std::string filename);
    ~texture2d();

    const texture2d& operator=(const texture2d& texture);

    void bind();

    // tex parameter functions
    static void clamp(bool enable = true);
    static void filter(bool enable = true);

    // tex environment functions
    static void modulate();
    static void decal();
    static void blend();
    static void replace();

  private:
    GLubyte*     data;
    unsigned int size;
    unsigned int width;
    unsigned int height;
    GLuint       tex_name;

    bool clamped;
  };
}

#endif
